package com.fysports.web.event.upload;

import com.google.common.eventbus.Subscribe;
import com.jfinal.log.Log;
import com.fysports.web.kit.commons.FileKit;


/**
 * Class title:  根据UploadEvent处理上传事件    <br/>
 * Describe:                    <br/>
 * Created by konbluesky           <br/>
 * Date : 15/12/29 下午5:15       <br/>
 * Project : weixin    <br/>
 */
public class UploadSubscribe {
    private static Log logger = Log.getLog(UploadSubscribe.class);
    @Subscribe
    public void commit(UploadEvent event){
        logger.info("=========start=====commit ");
        if(event.getType()== UploadEvent.TYPE.MOVE){
            String d=FileKit.getDiretory(event.getModule().toString(),event.getUuid());
            FileKit.moveTmpToReal(d);
        }else if(event.getType()== UploadEvent.TYPE.DELETE){
            //TODO
        }
        logger.info("=========end=====commit ");
    }
}
